package com.haozhen.pgproject

/**
  * @author haozhen
  * @email haozh@ync1.com
  * @date 2021/2/7  12:00
  */
case class BusInfo(deployNum:String,
                   simNum:String,
                   transportNum:String,
                   plateNum:String,
                   lglat:String,
                   speed:String,
                   direction:String,
                   mileage:String,
                   timeStr:String,
                   oilRemain:String,
                   weights:String,
                   acc:String,
                   locate:String,
                   oilWay:String,
                   electirc:String) {

}

object BusInfo{

  def apply(msg:String): BusInfo ={
    val arr = msg.split(",")
    if (arr.length==15){
      new BusInfo(arr(0), arr(1), arr(2),arr(3),arr(4),arr(5),arr(6),
        arr(7), arr(8), arr(9),arr(10),arr(11),arr(12),arr(13),arr(14))
    }else{
      null
    }
  }
}
